package pers.zb.cloud.service.upms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.zb.cloud.service.upms.dao.RoleClientAuthorizeMapper;
import pers.zb.cloud.service.upms.entity.SysRoleClientAuthorize;
import pers.zb.cloud.service.upms.service.RoleClientAuthorizeService;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 角色 - 应用
 *      关联表，角色有权访问的应用
 */
@Service("roleClientAuthorizeServiceImpl")
public class RoleClientAuthorizeServiceImpl extends BaseServiceImpl<SysRoleClientAuthorize> implements RoleClientAuthorizeService {

    @Autowired
    private RoleClientAuthorizeMapper roleClientAuthorizeMapper;

    /**
     * 获取角色能访问的应用
     * @param userRoleIdList
     * @return
     */
    @Override
    public List<SysRoleClientAuthorize> getHaveAccessClientListByRoles(List<Long> userRoleIdList) {
        Example example = new Example(SysRoleClientAuthorize.class);
        example.createCriteria().andIn("roleId",userRoleIdList);
        List<SysRoleClientAuthorize> sysRoleClientAuthorizeList = roleClientAuthorizeMapper.selectByExample(example);
        return sysRoleClientAuthorizeList;
    }
}
